水题,只有1种药的时候只需要1个瓶子,再每多1种就多两个瓶子。ans=x*2-1.
Github: https://github.com/wmpeng/Algorithm1
2
3
4
5
6
7
8
9
10
11
12
13
14
using namespace std;
int main()
{
int t, x,i;
scanf("%d", &t);
for (i = 1; i <= t;i++)
{
scanf("%d", &x);
printf("Case #%d: %d\n", i,x * 2 - 1);
}
return 0;
}